package com.example.search;

import com.example.service.PostsIndexService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author 小岁
 * @version 2023/10/28 10:51
 */
//自动调用service层
@Component
public class StartRun implements CommandLineRunner {

    private final PostsIndexService postsIndexService;

    public StartRun(PostsIndexService postsIndexService) {
        this.postsIndexService = postsIndexService;
    }

    @Override
    public void run(String... args) throws Exception {
        postsIndexService.initIndex();
    }
}
